package com.tyrone.leetcode.weekgame;

import java.util.Arrays;

/**
 * @author yelong.xie
 * @date 2024/1/21 11:04
 */
public class CountOfPairs {
    public static void main(String[] args) {
        int[] ints = CountOfPairs.countOfPairs(5, 2, 4);
        System.out.println(Arrays.toString(ints));
    }
    public static int[] countOfPairs(int n, int x, int y) {
        int[] arr = new int[n];
        arr[0] = 2 * (n - 1);
        if (x != y) {
            arr[0] += 2;
        }
        for (int i = 1; i < n; i++) {
            //2
            int count = 0;
            int gap = i+1;
            int j = 1+gap;
            while (j<=n){
                count+=2;
                j+=gap;
            }
            arr[i] = count;
        }

        for (int i = 1; i < x; i++) {
            arr[x-i]+=2;
        }

        for (int i = y+1; i < n; i++) {
            arr[i-y]+=2;
        }
        return arr;
    }
}
